/**
 *
 */
package com.kandinfo.survey.common.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kandinfo.base.common.dto.ResultDto;
import com.kandinfo.survey.common.dto.PatientFamilyDto;
import com.kandinfo.survey.common.service.PatientFamilyRelativeService;

/**
 * 病人家属关联controller
 * 
 * @author tangqh
 */
@Controller
@RequestMapping(value = "/weixin/patientfamily")
public class PatientFamilyController {

    @Autowired
    PatientFamilyRelativeService relativeService;

    /**
     * 家属病人关联页面
     */
    @RequestMapping(value = "/user-connect", method = RequestMethod.GET)
    public String connectPage(Model model) {
        return "/weixin/user/user-connect";
    }

    /**
     * 家属病人关联
     * 
     * @param patientFamillyDto
     *            (病人手机号, 病人姓名)
     */
    @RequestMapping(value = "/connect-family", method = RequestMethod.POST)
    @ResponseBody
    public ResultDto connectFamily(@RequestBody PatientFamilyDto patientFamillyDto) {
        return relativeService.connectFamily(patientFamillyDto);
    }
    
    /**
     * 获取病人信息
     * 
     * @param patientFamillyDto
     *            (病人手机号, 病人姓名)
     */
    @RequestMapping(value = "/get-connected-family", method = RequestMethod.POST)
    @ResponseBody
    public ResultDto getConnectedFamily() {
        return relativeService.getConnectedFamily();
    }
}
